from oneconvert.converter import Converter
from oneconvert import driver


class DefaultConverter(Converter):
    """轻量数据转换，默认将输入数据全部读到内存经过处理后再持久化"""

    def convert(self):
        input_format = self.get_input_format()
        output_format = self.get_output_format()
        if not input_format or not output_format:
            raise ValueError('Could not find input format and output format')

        driver.get_driver(input_format, output_format, self.input_url, self.output_url, **self.kwargs).handle()
